package com.ut.richpath.model;

import com.ut.richpath.RichPath;
import com.ut.richpath.util.XmlParser;
import ohos.app.Context;
import ohos.global.resource.solidxml.Attribute;
import ohos.org.xml.sax.Attributes;

import java.util.ArrayList;
import java.util.List;

public class Vector {

    public static final String TAG_NAME = "vector";

    private String name;
    private int tint = 0;
    private float height = 0;
    private float width = 0;
    private float alpha = 0;
    private boolean autoMirrored = false;


    private float viewportWidth = 0f;
    private float viewportHeight = 0f;
    private float currentWidth = 0f;
    private float currentHeight = 0f;

    private List<RichPath> paths = new ArrayList();

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getTint() {
        return tint;
    }

    public void setTint(int tint) {
        this.tint = tint;
    }

    public float getHeight() {
        return height;
    }

    public void setHeight(float height) {
        this.height = height;
    }

    public float getWidth() {
        return width;
    }

    public void setWidth(float width) {
        this.width = width;
    }

    public float getAlpha() {
        return alpha;
    }

    public void setAlpha(float alpha) {
        this.alpha = alpha;
    }

    public boolean isAutoMirrored() {
        return autoMirrored;
    }

    public void setAutoMirrored(boolean autoMirrored) {
        this.autoMirrored = autoMirrored;
    }

    public float getViewportWidth() {
        return viewportWidth;
    }

    public void setViewportWidth(float viewportWidth) {
        this.viewportWidth = viewportWidth;
    }

    public float getViewportHeight() {
        return viewportHeight;
    }

    public void setViewportHeight(float viewportHeight) {
        this.viewportHeight = viewportHeight;
    }

    public float getCurrentWidth() {
        return currentWidth;
    }

    public void setCurrentWidth(float currentWidth) {
        this.currentWidth = currentWidth;
    }

    public float getCurrentHeight() {
        return currentHeight;
    }

    public void setCurrentHeight(float currentHeight) {
        this.currentHeight = currentHeight;
    }

    public List<RichPath> getPaths() {
        return paths;
    }

    public void setPaths(List<RichPath> paths) {
        this.paths = paths;
    }


    public void inflate(Context context, Attributes attributes) {
        name = XmlParser.getAttributeString(attributes, "name", name);
        tint = XmlParser.getAttributeColor(attributes, "tint", 0x00000000);
        width = XmlParser.getAttributeDimension(context, attributes, "width", width);
        height = XmlParser.getAttributeDimension(context, attributes, "height", height);
        alpha = XmlParser.getAttributeFloat(attributes, "alpha", alpha);
        autoMirrored = XmlParser.getAttributeBoolean(attributes, "autoMirrored", autoMirrored);
        viewportWidth = XmlParser.getAttributeFloat(attributes, "viewportWidth", viewportWidth);
        viewportHeight = XmlParser.getAttributeFloat(attributes, "viewportHeight", viewportHeight);
        currentWidth = viewportWidth;
        currentHeight = viewportHeight;
    }
    public void inflate(Context context, List<Attribute> attributes) {
        name = XmlParser.getAttributeString(attributes, "name", name);
        tint = XmlParser.getAttributeColor(attributes, "tint", 0x00000000);
        width = XmlParser.getAttributeDimension(attributes, "width", width);
        height = XmlParser.getAttributeDimension(attributes, "height", height);
        alpha = XmlParser.getAttributeFloat(attributes, "alpha", alpha);
        autoMirrored = XmlParser.getAttributeBoolean(attributes, "autoMirrored", autoMirrored);
        viewportWidth = XmlParser.getAttributeFloat(attributes, "viewportWidth", viewportWidth);
        viewportHeight = XmlParser.getAttributeFloat(attributes, "viewportHeight", viewportHeight);
        currentWidth = viewportWidth;
        currentHeight = viewportHeight;
    }

}
